<?php

// $dst = imageCreateTrueColor(250,250); 

$src = imageCreateFrompng('./bg.png');

$w = imagesx($src);

$h = imagesy($src);

$mid = imageCreateTrueColor($w/2,$h/2); 

$small = imageCreateTrueColor($w/4,$h/4);  

imagecopyresized ( $mid,$src, 0 , 0, 0, 0 ,  $w/2 , $w/2 ,$w , $h);

imagecopyresized ( $small,$src, 0 , 0, 0, 0 ,  $w/4 , $w/4 ,$w , $h);


imagepng($mid,'./mid.png');

imagepng($small,'./small.png');

// $logo = imageCreateFromjpeg('./logo.jpg');

// $w = imagesx($logo);

// $h = imagesy($logo);

// var_dump($src);

// imagecopy ($src,$logo, 100, 100 ,0,0, $w, $h);

// imagecopymerge ($src,$logo, 100, 100 ,0,0, $w, $h ,50);

// imagecopyresized ( $src,$logo, 50 , 50 , 0, 0 ,  $w/2 , $w/2 ,$w , $h);

// imagecopy ($dst,$src, 0, 0 ,200,200, 250 , 250);


// header("Content-type: image/png");

// imagepng($src);